<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>

<s:include value="../header.jsp"></s:include>
<s:include value="../leftNav.jsp"></s:include>

<div id="content">

<div id="tabs">
	<ul>
		<li><s:a href="#tabs-1" action="testActionJsp.action">Edit project</s:a></li>
		<li><s:a href="#tabs-2" action="testActionJsp.action">Edit project users</s:a></li>
	</ul>
	<div id="tabs-1">
 		<p>Edit Project</p>
		<s:form name="addForm" method="post" action="editProjectForm.action" theme="xhtml">
			<s:textfield name="title" label="Title" size="60"/>
			<s:textarea label="Description" name="description" cols="60" rows="6"/>
			<s:textfield name="defaultIterationLenght" label="Default iteration lenght" size="10"/>
			<s:textfield name="nextIterationLenght" label="Next iteration lenght" size="10"/>
			<sx:datetimepicker name="predictedEndDate" label="Predicted end date" 
				displayFormat="dd-MMM-yyyy" value="todayDate" />
			<s:submit type="button" name="Add" label="Save" />
		</s:form>
	</div>
	<div id="tabs-2">
 		<h3>Edit project users:</h3>
		<s:form name="addForm" method="post" action="editProjectUsers.action" theme="xhtml">
			<sx:autocompleter label="Add user" list="usersSystem" name="addedUser" size="30"/>
			<s:submit type="button" name="Add" label="Add user"/>
		</s:form>
		
		<s:if test="users.size > 0">
			<h3>Users already added to project:</h3>
			<table id="users">
				<tr>
						<td>Username:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
						<td>User email:</td>
				</tr>
				<s:iterator value="users">
					<tr>
						<td><s:property value="username" /></td>
						<td><s:property value="email" /></td>
						<td><s:url id="deleteUser" value="removeUsers.action">
								<s:param name="userId" value="userId" />
							</s:url> <s:a href="%{deleteUser}">Remove</s:a>
						</td>
					</tr>
				</s:iterator>
			</table>
		</s:if>
	</div>
</div>
</div>
</body>
</html>